<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;
/**
 *  给我留言控制器
 */
class ContactController extends Controller{
    	//显示页
    	public function index(){
    			$this->display();
    	}
    	
    	public function msg(){
    			if (IS_AJAX) {
    				$data = Q('post.');
    				if (empty($data['uname']) || empty($data['email']) || empty($data['subject']) || empty($data['content'])) {
    					echo json_encode(array('status'=>0,'msg'=>'表单数据必须都填写'));die;
    				}
					//往msg表插入数据
    				$data['sendtime'] = time();
					if ($id = Db::table('msg')->insertGetId($data)) {
							echo json_encode(array('status'=>$id));
							die;
					}
				}
    	}
}
